-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for Databricks Apps in DABs #1928
base: main
Are you sure you want to change the base?
Conversation
bc4c9ac
to
d72b03e
Compare
## Changes Added support for bundle generate and bind for Apps ## Tests - [ ] Add E2E test
Test Details: go/deco-tests/12394072048 |
diags := bundle.Apply(context.Background(), b, InterpolateVariables()) | ||
require.Empty(t, diags) | ||
require.Equal(t, []any([]any{map[string]any{"name": "JOB_ID", "value": "123"}}), b.Config.Resources.Apps["my_app_1"].Config["env"]) | ||
require.Nil(t, b.Config.Resources.Apps["my_app_2"].Config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test works but doesn't actually use the translation map.
I suspect you intend to make sure that the conversion of bundle-internal field references to Terraform resource field references is undone so that we can interpolate the IDs ourselves. But the test runs against a bundle-internal field reference.
Is there an alternative approach such that we don't have to convert back-and-forth? Maybe we completely skip this path during variable resolution? Or only skip resources.*
references under resources.apps.*.config.**
? Then we have less coupling with the TF resource interpolation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to keep conversion to TF for all resources and then having this separate mutator which converts it back. The reasons are:
- We will still need to keep InterpolateVariables mutator in both cases (with or without the conversion)
- If we decide to add more fields to be processed this way we will need to add 2 changes in 2 places: a conditional skip in TF mutator, and the processing of the field in InterpolateVariables mutator. Without the skip we just need to add the change in 1 place (InterpolateVariables)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works for me.
The test now uses the TF notation, so it will fail when that is changed.
diags := bundle.Apply(context.Background(), b, InterpolateVariables()) | ||
require.Empty(t, diags) | ||
require.Equal(t, []any([]any{map[string]any{"name": "JOB_ID", "value": "123"}}), b.Config.Resources.Apps["my_app_1"].Config["env"]) | ||
require.Nil(t, b.Config.Resources.Apps["my_app_2"].Config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works for me.
The test now uses the TF notation, so it will fail when that is changed.
// It means we need to write app.yml file with the content of the config field | ||
// to the remote source code path of the app. | ||
if app.Config != nil { | ||
appPath := strings.TrimPrefix(app.SourceCodePath, b.Config.Workspace.FilePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fjakobs @ilyakuz-db FYI, this is a potential problem for source-linked deployments. We assume here that files are deployed under ${workspace.file_path}
and then write a file into it. If we were to make this work for source-linked deployments, this would have to write a file to the source folder itself, which in turn means we'll get validation errors (we check that the user does not have both an app.yml
and a configuration section in the bundle configuration for their app.
The fact that we have to think about this (and potentially work around it) illustrates the problem that this duality brings.
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Changes
Now it's possible to configure new
app
resource in bundle and point it to the customsource_code_path
location where Databricks App code is defined.On
databricks bundle deploy
DABs will create an app. All consecutivedatabricks bundle deploy
execution will update an existing app if there are any updatedOn
databricks bundle run <my_app>
DABs will execute app deployment. If the app is not started yet, it will start the app first.Bundle configuration
Execution
databricks bundle deploy -t dev
databricks bundle run my_app -t dev
If app is started
If app is not started
Tests
Added unit and config tests + manual test.